// 获取验证码
import request from "@/utils/request";

const client = process.env.VUE_APP_CLIENT

export function init() {
  return request({
    url: '/auth/' + client,
    headers: {
      isToken: false
    },
    method: 'get',
    timeout: 20000
  })
}

// 获取用户详细信息
export function getInfo() {
  return request({
    url: '/auth/getInfo',
    method: 'get'
  })
}

// 获取路由
export const getRouters = () => {
  return request({
    url: '/auth/getRouters',
    method: 'get'
  })
}

// 登录方法
export function login(loginData) {
  const data = {...loginData, client: client}
  return request({
    url: '/auth/login',
    headers: {
      isToken: false
    },
    method: 'post',
    data: data
  })
}

// 退出方法
export function logout() {
  return request({
    url: '/auth/logout',
    method: 'post'
  })
}
